/**
 * 
 */
package com.chocolatefordogs.writersnb.menu;

import java.util.ResourceBundle;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import com.chocolatefordogs.writersnb.main.MainWindowController;
import com.chocolateforogs.writersnb.res.ResourceLoader;

/**
 * @author Matthew
 *
 */
public final class MainMenu {
	
	public MainMenu(final MainWindowController mwCont) {
		menu = new JMenuBar();
		this.mwCont = mwCont;
		initItems();
	}
	
	private void initItems() {
		final ResourceBundle res = ResourceLoader.getClassResources(getClass());
		final JMenu fileMenu = new JMenu(); 
		fileMenu.setText(res.getString("file.text"));
		fileMenu.setMnemonic(res.getString("file.mnemonic").charAt(0));
		menu.add(fileMenu);
		
		final JMenuItem exitMenu = new JMenuItem();
		exitMenu.setAction(new ExitAction(mwCont, res.getString("file.exit.text")));
		exitMenu.setMnemonic(res.getString("file.exit.mnemonic").charAt(0));
		
		fileMenu.add(exitMenu);
	}
	
	public JMenuBar getMenu() {
		return menu;
	}

	private final JMenuBar menu;
	private final MainWindowController mwCont;
}
